//
//  WWAqiWeatherInfoCollectionViewCell.m
//  WhatWeather
//
//  Created by byn on 16/3/20.
//  Copyright © 2016年 byn. All rights reserved.
//

#import "WWAqiWeatherInfoCollectionViewCell.h"

@implementation WWAqiWeatherInfoCollectionViewCell

- (void)configureCell : (NSIndexPath*)aqiType weatherInfo : (WWWeatherInfo *)weatherInfo {
    
    NSString *aqiName = nil;
    NSString *aqiDegree = nil;
    NSString *aqiUnit = @"µg/m³";
    
    switch (aqiType.row) {
        case 0:
            aqiName = @"AQI";
            aqiDegree = weatherInfo.aqi;
            break;
        case 1:
            aqiName = @"CO";
            aqiDegree = weatherInfo.co;
            break;
        case 2:
            aqiName = @"NO2";
            aqiDegree = weatherInfo.no2;
            break;
        case 3:
            aqiName = @"O3";
            aqiDegree = weatherInfo.o3;
            break;
        case 4:
            aqiName = @"PM10";
            aqiDegree = weatherInfo.pm10;
            break;
        case 5:
            aqiName = @"PM2.5";
            aqiDegree = weatherInfo.pm25;
            break;
        case 6:
            aqiName = @"SO2";
            aqiDegree = weatherInfo.so2;
            break;
        default:
            break;
    }
    _aqiNameLabel.text = aqiName;
    _aqiDegreeLabel.text = aqiDegree;
    _aqiUnit.text = aqiUnit;
    [_aqiPercentProgressView setProgress:[aqiDegree floatValue]/500.0 animated:TRUE];
    _aqiPercentProgressView.progressTintColor = [UIColor colorWithRed:246.0/255 green:205.0/255 blue:46.0/255 alpha:1];
    _aqiPercentProgressView.trackTintColor = [UIColor colorWithRed:120.0/255 green:137.0/255 blue:101.0/255 alpha:1];
}

@end












































